public class Solution {
    private int[] a = {2, 3, 3, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 3, 1, 1, 1, 1, 2, 1, 1, 3, 1, 3, 1, 3};

    public String[] findWords(String[] words) {
        List<String> list = new ArrayList<>();
        for(String word : words) {
            char[] chars = word.toLowerCase().toCharArray();
            boolean flag = true;
            for(char c : chars) {
                if(a[c - 'a'] != a[chars[0] - 'a']) {
                    flag = false;
                }
            }
            if(flag) {
                list.add(word);
            }
        }
        return list.toArray(new String[list.size()]);
    }
}
